package com.xy.biz.xd.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.tool.util.BeanUtilsEx;
import com.xy.biz.xd.domain.bo.DocumentReleaseCheckBO;
import com.xy.biz.xd.domain.po.DocumentReleaseCheckPO;
import com.xy.biz.xd.domain.query.DocumentReleaseCheckQuery;
import com.xy.biz.xd.domain.resp.GetDocumentReleaseCheckResponse;
import com.xy.biz.xd.domain.req.SaveDocumentReleaseCheckRequest;
import com.xy.biz.xd.domain.req.ListDocumentReleaseCheckRequest;

/**
 * 
 * 
 * @author zgy
 * @date 2021-5-26
 */
public class DocumentReleaseCheckConverter {
	
	public static DocumentReleaseCheckPO toPO(DocumentReleaseCheckBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentReleaseCheckPO(), true);
	}
	
	public static List<DocumentReleaseCheckPO> toPO(Collection<DocumentReleaseCheckBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentReleaseCheckPO(), true);
	}
	
	public static DocumentReleaseCheckBO fromPO(DocumentReleaseCheckPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentReleaseCheckBO());
	}
	
	public static List<DocumentReleaseCheckBO> fromPO(Collection<DocumentReleaseCheckPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentReleaseCheckBO());
	}
	
	public static DocumentReleaseCheckBO toBO(SaveDocumentReleaseCheckRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentReleaseCheckBO(), true);
	}
	
	public static List<DocumentReleaseCheckBO> toBO(Collection<SaveDocumentReleaseCheckRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentReleaseCheckBO(), true);
	}
	
	public static GetDocumentReleaseCheckResponse toResponse(DocumentReleaseCheckBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetDocumentReleaseCheckResponse());
	}
	
	public static List<GetDocumentReleaseCheckResponse> toResponse(Collection<DocumentReleaseCheckBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetDocumentReleaseCheckResponse());
	}
	
	public static DocumentReleaseCheckQuery toQuery(ListDocumentReleaseCheckRequest source) {
		if(null == source) {
			return null;
		}
		DocumentReleaseCheckQuery target = new DocumentReleaseCheckQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
